#-*- coding: utf-8 -*-
from django.db import models
from iFriends.People.models import Person
from django.contrib import admin

# Create your models here.
class UserPoll(models.Model):
    question = models.CharField('Question', max_length=100)
    date = models.DateTimeField('Creation Date')
    person = models.ForeignKey(Person)

    def __str__(self):
        return '%s' % (self.question)
    


class Opinion(models.Model):
    poll = models.ForeignKey(UserPoll)
    opinion = models.CharField('Opinion', max_length=50)
    votes = models.IntegerField('Vote Count')

    def __str__(self):
        return '%s' % (self.opinion)

class OpinionInline(admin.TabularInline):
    model = Opinion
    extra = 3
    
class UserPollAdmin(admin.ModelAdmin):
    inlines = [
        OpinionInline,
    ]

admin.site.register(UserPoll, UserPollAdmin)
